package collection.list;

import java.util.ArrayList;
import java.util.Collections;

public class Demo05DouDIZhu {
    public static void main(String[] args) {
        ArrayList<String> kapai = new ArrayList<>();
        ArrayList<String> player01 = new ArrayList<>();
        ArrayList<String> player02 = new ArrayList<>();
        ArrayList<String> player03 = new ArrayList<>();
        ArrayList<String> dipai = new ArrayList<>();

        String[] colors = {"♥", "♠", "♦", "♣"};
        String[] num = {"2","A", "K", "Q", "J", "10", "9", "8", "7", "6", "5", "4", "3"};

        for (String s1 : num)
            for (String s : colors)
                kapai.add(s + s1);


        kapai.add("大王");
        kapai.add("小王");

        Collections.shuffle(kapai);
        for (int i = 0; i < kapai.size(); i++) {
            if (i > 50) {
                dipai.add(kapai.get(i));
            } else if (i % 3 == 0) {
                player01.add(kapai.get(i));
            } else if (i % 3 == 1) {
                player02.add(kapai.get(i));
            } else if (i % 3 == 2) {
                player03.add(kapai.get(i));
            }
        }

        Collections.sort(player01);
        Collections.sort(player02);
        Collections.sort(player03);
        Collections.sort(dipai);

        System.out.println("玩家1：" + player01);
        System.out.println("玩家2：" + player02);
        System.out.println("玩家3：" + player03);
        System.out.println("底牌：" + dipai);
    }
}
